package com.niit.musicserve.service.impl;

import com.niit.musicserve.dao.SongMapper;
import com.niit.musicserve.entity.Song;
import com.niit.musicserve.service.SongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SongServiceImpl implements SongService {
	
	@Autowired
	public SongMapper songMapper;
	
	@Override
	@Transactional
	public int insertSong(Song song) {
		return songMapper.insertSong(song);
	}
	
	@Override
	@Transactional
	public int deleteSongById(int id) {
		return songMapper.deleteSongById(id);
	}
	
	@Override
	@Transactional
	public int updateSongById(Song song) {
		return songMapper.updateSongById(song);
	}
	
	@Override
	public List<Song> allSong() {
		return songMapper.allSong();
	}
	
	@Override
	public List<Song> allSongWithSinger(){return songMapper.allSongWithSinger();}
	
	@Override
	public Song songById(Integer id) {
		return songMapper.songById(id);
	}
	
	@Override
	public List<Song> likeSongByName(String songName) {
		return songMapper.likeSongByName(songName);
	}
	
	@Override
	public List<Song> songByName(String songName){ return  songMapper.songByName(songName);}
	
	@Override
	public List<Song> songBySingerId(Integer singerId) {
		return songMapper.songBySingerId(singerId);
	}
	
	@Override
	public Integer numberOfSong() {return songMapper.numberOfSong();
	}
}
